home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 October: Mac OS SDK / Dev.CD Oct 97 SDK1.toast / Development Kits (Disc 1) / QuickDraw GX / Programming Stuff / Sample Code / Typography Samples / Circular Layout ƒ / About Circular Layout next >
Encoding:
Text File  |  1995-04-10  |  1.6 KB  |  34 lines  |  [ttro/ttxt]

  1. Circular Layout Notes
  2.  
  3. This sample does not use the "standard" QuickDraw GX shell, but uses a
  4. hacked-up version of it.  We do this because the standard shell is based around
  5. the idea that all windows are basically pictures, and in this sample the window
  6. contains moving shapes.  If we tried to keep things as a single picture, we'd
  7. be calling GXGetPictureParts and GXSetPictureParts all the time, and this would
  8. not be good for performance.
  9.  
  10. So the shell is hacked to track two oval shapes for every document.  The first oval is
  11. the shape we draw.  It looks like curved layouts because the oval is drawn with
  12. a dash shape created from a layout shape.  This, in my own opinion, is really
  13. cool.
  14.  
  15. The second shape is a copy of that oval, but colored white -- drawing this oval
  16. on top of the other one effectively erases the first.  We calculate it every
  17. time we need it, but we keep a copy with the document so we're not constantly
  18. creating and disposing of shapes.
  19.  
  20. Each time there's no event to process, we call the DoIdle routine.  It calls
  21. the draw routine, which changes the oval slightly and redraws it.  As it
  22. changes and creates the shapes to draw, it caches them with GXCacheShape so
  23. that when they draw, they'll draw as fast as possible.  If you don't believe
  24. this matters, try commenting out the GXCacheShape calls for the ovals and
  25. watching the difference.
  26.  
  27. To print, though, we make a picture shape and use the shell's existing picture
  28. printing code.  This seemed easier than rewriting even more code.
  29.  
  30. Yes, this sample supports multiple windows as well, but only the front window
  31. shows any action.
  32.  
  33. QuickDraw™ GX Developer Support Center
  34.